package com.itheima.mapper;

import com.itheima.pojo.Student;
import com.itheima.pojo.StudentQueryParam;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface StudentMapper {

    List<Student> list(StudentQueryParam param);
    @Options(useGeneratedKeys = true,keyProperty = "id")
    @Insert("insert into student(name,no,gender,phone,id_card,is_college,address,degree,graduation_date,clazz_id,create_time,update_time) " +
            "values(#{name},#{no},#{gender},#{phone},#{idCard},#{isCollege},#{address},#{degree},#{graduationDate},#{clazzId},#{createTime},#{updateTime})")
    void add(Student student);
    @Select("select * from student where id=#{id}")
    Student getById(Integer id);


    void putStudent(Student student);

    void delete(String[] split);
    @Update("update student set violation_score=#{violationScore1},violation_count=#{violationCount} where id=#{id}")
    void update(Integer id, short violationScore1, Short violationCount);
    @Select("select count(*) from student where clazz_id=#{clazzId}")
    Long selectCountByDeptId(Integer clazzId);
}

